package com.example.myapplication0523.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;

import com.example.myapplication0523.R;

public class MainActivity extends Activity implements View.OnClickListener {
    private Button smsBtn;
    private Button toutiaoBtn;
    private Button alipayBtn;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView(); //配置组件
        initData(); //配置数据
    }

    /**
     * 配置数据
     */
    private void initData() {

    }

    /**
     * 配置组件
     */
    private void initView() {
        smsBtn= findViewById(R.id.btn_sms);
        toutiaoBtn= findViewById(R.id.btn_toutiao);
        alipayBtn= findViewById(R.id.btn_alipay);

        smsBtn.setOnClickListener(this);
        toutiaoBtn.setOnClickListener(this);
        alipayBtn.setOnClickListener(this);
    }

    /**
     * 配置点击事件
     * @param v The view that was clicked.
     */
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn_sms: //验证码登录
                startActivity(new Intent(this, SMSActivity.class));
                break;
            case R.id.btn_toutiao: //头条
                startActivity(new Intent(this, ToutiaoActivity.class));
                break;
            case R.id.btn_alipay: //支付宝
                startActivity(new Intent(this, AlipayActivity.class));
                break;

        }
    }
}
